﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
     
    public class GridPagingSettingsBuilder
    {
        private readonly GridPagingSettings paging;
        private readonly GridAjaxSettings ajax;

        public GridPagingSettingsBuilder(GridPagingSettings paging, GridAjaxSettings ajax)
        {
            this.paging = paging;
            this.ajax = ajax;
        }
         

        /// <summary>
        /// 是否启用分页
        /// </summary>
        /// <param name="enabled"></param>
        /// <returns></returns>
        public GridPagingSettingsBuilder Enabled(bool enabled)
        { 
            if (enabled)
            {
                this.paging.UsePager = true; 
            }
            else
            {
                this.paging.UsePager = false; 
            } 
            return this;
        }
           
        /// <summary>
        /// 设置 默认当前页
        /// </summary>
        public GridPagingSettingsBuilder Page(int value)
        {
            this.paging.Page = value;
            return this;
        } 
        /// <summary>
        /// 设置 每页默认的结果数
        /// </summary>
        public GridPagingSettingsBuilder PageSize(int value)
        {
            this.paging.PageSize = value;
            return this;
        } 

        /// <summary>
        /// 设置 可选择设定的每页结果数
        /// </summary>
        public GridPagingSettingsBuilder PageSizeOptions(IList<int> value)
        {
            this.paging.PageSizeOptions = value;
            return this;
        }
         

    }
}
